// pages/select/select.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    source: '',
    dst: '',
    date: '请选择日期'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  // 当日期选择器的内容发生改变
  bindDateChange: function(e) {
    this.setData({
      date: e.detail.value
    })

    getApp().globalData.datee = this.data.date;
  },

  srcInput: function(e) {
    this.setData({
      source: e.detail.value
    })

    getApp().globalData.source = this.data.source;
  },

  dstInput: function(e) {
    this.setData({
      dst: e.detail.value
    })

    getApp().globalData.dst = this.data.dst;
  },

  switchPlace: function() {
    var dst = this.data.dst;
    var source = this.data.source
    
    this.setData({
      source: dst,
      dst: source
    })
    
    getApp().globalData.source = this.data.source;
    getApp().globalData.dst = this.data.dst;
  },

  selectAction: function () {

    if(this.data.date == '请选择日期') {
      wx.showToast({
        title: '请选择日期',
        image: '/images/x1.png'
      })
    }
    else {
      wx.showLoading({
        title: '查询中...',
      })
  
      wx.navigateTo({
        url: '/pages/showTicket/showTicket',
      })
      wx.hideLoading()
    }
  },

  onShow: function () {

  }
})